package model.arboles;
/*

    This file is part of Logica-Logike.

    Logica-Logike is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation version 3 of the License.

    Logica-Logike is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Logica-Logike.  If not, see <http://www.gnu.org/licenses/>.

 */
/**
 * @author Maria Julia Racca;
 */
public class MolecularProposition extends AbstractProposition {

    private Proposition first;
    private Operation operation;
    private Proposition second;

    public MolecularProposition(Proposition first, Operation operations,
                                Proposition second, boolean isNot) {

        this.first = first;
        this.second = second;
        this.operation = operations;

        if (isNot) {
            this.negated = Operation.NOT;
        } else {
            this.negated = Operation.NON;
        }
    }

    public MolecularProposition(Proposition first2, Operation and,
                                Proposition second2, Operation operation2) {

        this.first = first2;
        this.second = second2;
        this.operation = and;
        this.negated = operation2;
    }

    public Proposition getFirst() {
        return first;
    }

    public Operation getOperation() {
        return operation;
    }

    public Proposition getSecond() {
        return second;
    }

    @Override
    public String toString() {

        StringBuffer sb = new StringBuffer();

        sb.append(negated.toString());
        sb.append("(");
        sb.append(first.toString());
        sb.append(" ");
        sb.append(operation.toString());
        sb.append(" ");
        sb.append(second.toString());
        sb.append(")");

        return sb.toString();
    }

    public void setFirst(Proposition first) {
        this.first = first;
    }

    public void setSecond(Proposition second) {
        this.second = second;
    }

    public void setOperation(Operation operation) {
        this.operation = operation;
    }

}
